{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kxu1Gfhx1pHg"
   },
   "source": [
    "<a href=\"https://colab.research.google.com/github/jeffheaton/app_generative_ai/blob/main/t81_559_class_12_4_refinement_eval.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "ZbNbAV281pHh"
   },
   "source": [
    "# T81-559: Applications of Generative Artificial Intelligence\n",
    "**Module 12: Prompt Engineering**\n",
    "* Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx)\n",
    "* For more information visit the [class website](https://sites.wustl.edu/jeffheaton/t81-558/)."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {
    "id": "HwnvSYEQ1pHi"
   },
   "source": [
    "# Module 12 Material\n",
    "\n",
    "Module 12: Prompt Engineering\n",
    "\n",
    "* Part 12.1: Intro to Prompt Engineering [[Video]](https://www.youtube.com/watch?v=p8q2kFhyX3M&ab_channel=JeffHeaton) [[Notebook]](t81_559_class_12_1_prompt_engineering)\n",
    "* Part 12.2: Few Shot and Chain of Thought [[Video]](https://www.youtube.com/watch?v=Bj-zOiqpp6g&ab_channel=JeffHeaton) [[Notebook]](t81_559_class_12_2_fewshot_cot.ipynb)\n",
    "* Part 12.3: Persona and Role Patterns [[Video]](https://www.youtube.com/watch?v=uD9z3LFw7nA&ab_channel=JeffHeaton) [[Notebook]](t81_559_class_12_3_persona.ipynb)\n",
    "* **Part 12.4: Question, Refinement and Verification Patterns** [[Video]](https://www.youtube.com/watch?v=UF0gN79hg4g&ab_channel=JeffHeaton) [[Notebook]](t81_559_class_12_4_refinement_eval.ipynb)\n",
    "* Part 12.5: Content Creation and Structured Prompt Patterns [[Video]](https://www.youtube.com/watch?v=PPNnTDfKjPE&ab_channel=JeffHeaton) [[Notebook]](t81_559_class_12_5_create.ipynb)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "v2MPPX0c1pHi"
   },
   "source": [
    "# Part 12.4: Question, Refinement and Verification Patterns\n",
    "\n",
    "In this part, we'll delve into techniques for refining questions, validating information, and prompting based on iterative questioning and verification within the life insurance context. Mastering these patterns will enable you to obtain more accurate, detailed, and reliable information from Generative AI, enhancing your interactions and outcomes.\n",
    "\n",
    "### Question Refinement Pattern\n",
    "The Question Refinement Pattern involves starting with a broad question and then iteratively narrowing it down to obtain more specific and detailed information. This technique helps uncover deeper insights and clarifies complex topics.\n",
    "\n",
    "Example Prompt:\n",
    "\n",
    "```\n",
    "What are the main benefits of life insurance? Now, focus specifically on how life insurance can serve as an investment vehicle for retirement planning.\n",
    "```\n",
    "\n",
    "### Cognitive Verifier Pattern\n",
    "The Cognitive Verifier Pattern prompts the AI to verify or double-check information, ensuring accuracy and reliability in the response. This pattern is useful for validating facts or data provided by the AI.\n",
    "\n",
    "Example Prompt:\n",
    "\n",
    "```\n",
    "Explain how universal life insurance policies work. Verify the information by summarizing the key features and any associated risks.\n",
    "```\n",
    "\n",
    "### Fact Check List Pattern\n",
    "The Fact Check List Pattern instructs the AI to provide information in a checklist format, helping to verify details or ensure all aspects of a topic are covered.\n",
    "\n",
    "Example Prompt:\n",
    "\n",
    "```\n",
    "List the steps required to convert a term life insurance policy into a whole life policy, and briefly explain each step.\n",
    "```\n",
    "\n",
    "### Question-Answering Prompts\n",
    "Question-Answering Prompts are direct queries aimed at obtaining specific information from the AI. These prompts facilitate clear and concise answers to particular questions.\n",
    "\n",
    "Example Prompt:\n",
    "\n",
    "```\n",
    "What tax advantages are associated with life insurance payouts to beneficiaries?\n",
    "```\n",
    "\n",
    "### Refinement Prompts\n",
    "Refinement Prompts involve asking the AI to improve or elaborate on a previous response, enhancing the depth and quality of the information provided.\n",
    "\n",
    "Example Prompt:\n",
    "\n",
    "```\n",
    "You mentioned that life insurance can help with estate planning. Can you provide more details on how it minimizes estate taxes?\n",
    "```\n",
    "\n",
    "### Comparison/Contrast Prompts\n",
    "Comparison/Contrast Prompts ask the AI to highlight similarities and differences between two or more items, providing a clearer understanding of each.\n",
    "\n",
    "Example Prompt:\n",
    "\n",
    "```\n",
    "Compare and contrast variable life insurance and universal life insurance in terms of investment options and risk.\n",
    "```\n",
    "\n",
    "### Conditional Prompts\n",
    "Conditional Prompts instruct the AI to provide information based on specific conditions or scenarios, allowing for tailored and relevant responses.\n",
    "\n",
    "Example Prompt:\n",
    "\n",
    "```\n",
    "If a client is a smoker over the age of 50, how does that affect their life insurance premium and available policy options?\n",
    "```\n",
    "\n",
    "### Ask for Input Pattern\n",
    "The Ask for Input Pattern encourages the AI to request additional information or clarification, simulating a more interactive and personalized conversation.\n",
    "\n",
    "Example Prompt:\n",
    "\n",
    "```\n",
    "You are a life insurance advisor. Before making a recommendation, ask me questions to assess my coverage needs and financial situation.\n",
    "```\n",
    "\n",
    "By applying these patterns within the life insurance context, you can refine your interactions with Generative AI to obtain more precise, accurate, and relevant information. Practicing these techniques will enhance your ability to craft effective prompts, leading to better decision-making and communication in the field of life insurance.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "colab": {
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
